#!/usr/bin/tcc -run
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

int main()
{
    /*打开设备文件*/
    int fd = open("/dev/mmgdev0", O_RDWR);

#if 1
    char buff[100];
    memset(buff, 0 , sizeof(buff));

    lseek(fd, 0, SEEK_SET);
    //lseek(fd, 2, SEEK_SET);

    /*读取数据*/
    int s = 0;

    int resLen = read(fd, buff, 100);
    printf("%s\n", buff);

    /*关闭设备*/
    close(fd);
#endif

    return 0;
}
